const express = require("express");
const userController = require("../controller/userController");
const requireAuth = require("../middleware/requireAuth");

const router = express.Router();

//注册
router.post("/signup", userController.signup);

//登录
router.post("/signin", userController.signin);

//获取当前登录用户
router.get("/usermessage", requireAuth, userController.getUser);

//修改用户信息
router.patch("/usermessage", requireAuth, userController.updateUser);

//修改密码
router.patch("/password", requireAuth, userController.updatePassword);

//获取公司员工
router.get("/companysupplier", requireAuth, userController.getCompanyMember);

//添加供应商(修改员工role和company_id)
router.patch(
  "/supplier/:email/:action",
  requireAuth,
  userController.addSupplier
);

module.exports = router;
